package com.hanxiaozhang.system.dao;

import com.hanxiaozhang.system.dto.UserDTO;
import com.hanxiaozhang.system.entity.UserEntity;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 用户表
 *
 * @author hanxiaozhang
 * @email hanxiaozhang2018@sina.com
 * @date 2021-04-02
 */
@Mapper
public interface UserDao {

	UserDTO get(Long userId);
	
	List<UserDTO> list(Map<String, Object> map);

	int count(Map<String, Object> map);

	int save(UserEntity user);
	
	int update(UserEntity user);
	
	int remove(Long userId);

	int batchRemove(Long[] userIds);

	UserDTO getByUsername(@Param("username") String username);


	@Select("select  *  from `sys_user` where `username` = #{username} and `del_flag` = 0 and user_id !=#{userId}")
	UserEntity getByUsernameAndNoUserId(@Param("username") String username,@Param("userId") Long userId);

}
